home *** CD-ROM | disk | FTP | other *** search
- LOCBUG.DPR:
- program LocBug;
- uses
- LocBugA;
- begin
- end.
-
- LOCBUGA.PAS:
- unit LocBugA;
- interface
- {$HINTS OFF} {$WARNINGS OFF} {$ALIGN OFF}
- type
- TObjectA = class
- private
- UnusedA: integer; // Should not get hint, and we don't
- public
- procedure Destroy; // Should not get warning, and we don't
- end;
- TRecA = record // SizeOf(TRecA) should be 5, and it is
- A: char;
- L: longint;
- end;
- implementation
- uses
- LocBugB;
- {.$HINTS OFF} // Remove dots to work around the buggy behavior
- {.$WARNINGS OFF}
- type
- TObjectB = class
- private
- UnusedB: integer; // Should not get hint, but we do in D3
- (sometimes)
- public
- procedure Destroy; // Should not get warning, but we do
- (sometimes)
- end;
- {.$ALIGN ON} // If you remove the dot, you will get an invalid
- typecast below
- TRecB = record // SizeOf(TRecA) should be 5, and it is
- A: char;
- L: longint;
- end;
- procedure TObjectA.Destroy; begin end;
- procedure TObjectB.Destroy;
- var
- A: TRecA;
- begin
- TRecB(A).L := 123; // This is Ok because SizeOf(TRecA) =
- SizeOf(TRecB)
- end;
- end.
-
- LOCBUGB.PAS:
- unit LocBugB;
- interface
- implementation
- {$HINTS ON} {$WARNINGS ON} {$ALIGN ON}
- end.
-
-